<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"  %>

<!DOCTYPE HTML>
<html>
  <head>
    <title>singlefile.jsp</title>
    <link rel="stylesheet" type="text/css" href="static/bootstrap/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="static/css/wall.css" />
  </head>
  
  <body>
  	<%@ include file="top.jsp" %>
  	<div class="container" style="padding-top:60px">
  		<div class="row">
			<jsp:include page="left.jsp">
				<jsp:param value="folder" name="tag"/>
			</jsp:include>
			<div class="span9">
				<c:if test="${param.code eq 1002 }">
					<div class="alert alert-success">
					<button class="close" data-dismiss="alert" type="button">×</button>
					  	上传成功
					</div>
				</c:if>
				<a class="btn btn-primary offset7" type="button" data-toggle="modal" href="#myModal" >
					<i class="icon-share icon-white"></i>
					上传文件
				</a>
				<div class="modal hide fade" id="myModal">
				  <div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">×</button>
					<h3>上传资料</h3>
				  </div>
				  <form action="upload.jspx?m=up" method="post" enctype="multipart/form-data">
					  <div class="modal-body">
						<input type="file" name="mydocument"/>
					  </div>
					  <c:if test="${param.code eq 1003 }">
						<div class="alert alert-error">
						<button class="close" data-dismiss="alert" type="button">×</button>
						  	上传文件不能超过10 MB
						</div>
					</c:if>
					  <div class="modal-footer">
						<button type="submit" class="btn btn-primary">上传</button>
						<a href="#" class="btn" data-dismiss="modal">取消</a>
					  </div>
				  </form>
				</div>
				<div style="margin-top:10px">
					<ul class="breadcrumb" style="margin-bottom:0px;border-radius:3px 3px 0px 0px;">
						<li>
							<i class="icon-th"></i>
							<a href="folder.jspx?m=show">共享资料</a>
							>${requestScope.folderName}
						</li>
						<li style="float:right">
							<i class="icon-trash"></i>
							<a href="#">删除</a>
						</li>
					</ul>
				</div>
				<div class="wall">
					<table class="table" style="font-size:14px">
						<thead>
							<tr>
								<th >
									<span></span>
									<span style="margin-left:50px">
										名称
									</span>
								</th>
								<th>大小</th>
								<th>创建者</th>
							</tr>
						</thead>
						<tbody >
							<c:forEach items="${requestScope.docList}" var="document">
								<tr>
									<td>
										<div>
											<span style="margin-right:15px">
												<c:choose>
													<c:when test="${document.endName=='txt'}">
														<img src="static/img/txt.PNG" alt="txt"/>
													</c:when>
													<c:when test="${document.endName=='pdf'}">
														<img src="static/img/pdf.jpg" alt="pdf"/>
													</c:when>
													<c:when test="${document.endName=='docx'}">
														<img src="static/img/doc.PNG" alt="word"/>
													</c:when>
													<c:when test="${document.endName=='xlsx'}">
														<img src="static/img/excl.PNG" alt="excl"/>
													</c:when>
													<c:otherwise>
														<img src="static/img/file.png" alt="未知类型"/>
													</c:otherwise>
												</c:choose>
											</span>
											<span>
												<a href="upload.jspx?m=down&name=${document.name}">${document.realName}</a>
											</span>
										</div>
									</td>
									<td>${document.size/1000} KB</td>
									<td>
										<span>
											${document.member.name}
										</span>
										<span style="margin-left:20px">
											<a href="document.jspx?m=del&id=${document.id }">
												<i class="icon-trash" id="del" onclick="del('${document.realName}')"></i>
											</a>
										</span>
									</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
					<a href="folder.jspx?m=show">←返回文件夹列表</a>
			<!-- 		<div class="pagination pull-right" style="margin-top:40px">
						<ul>
							<li>
								<a href="#">Prev</a>
							</li>
							<li class="active">
								<a href="#">1</a>
							</li>
							<li>
								<a href="#">2</a>
							</li>
							<li>
								<a href="#">3</a>
							</li>
							<li>
								<a href="#">4</a>
							</li>
							<li>
								<a href="#">Next</a>
							</li>
						</ul>
					</div>
					<div class="clear"></div> -->
				</div>
			</div>
		</div>
  	</div>
  	<script type="text/javascript" src="static/jquery/jquery.js"></script>
	<script type="text/javascript" src="static/bootstrap/js/bootstrap.min.js"></script>
	<script type="text/javascript">
		function del(realname){
			if (confirm("确定要删除"+realname+"吗？")) {
				alert("删除成功！");
			}
		};
	</script>
  </body>
</html>
